#include <windows.h>
#include <stdio.h>
#include <iostream>

int main()
{
    HANDLE hFile;
    DWORD dwReturn;
    char szTemp[256] = {0};

    hFile = CreateFile(TEXT("\\\\.\\MyDevice"), GENERIC_WRITE | GENERIC_READ, 0, NULL, OPEN_ALWAYS, 0, NULL);

    if (hFile)
    {
        std::cout << "file created" << std::endl;
        WriteFile(hFile, "HOLA AMIGO!", sizeof("HOLA AMIGO!"), &dwReturn, NULL); 
        
        ReadFile(hFile, &szTemp, 256, &dwReturn, NULL);
        printf(szTemp);
        printf("\n");
                
        CloseHandle(hFile);
    }
 
    return 0;
}